<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="head.jsp" />
<link rel="stylesheet" type="text/css" href="${path}/css/monitor-taskstatistics.min.css?" />
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="main" title="Go to Home" class="tip-bottom"><i
				class="icon-home"></i> Home</a> <a href="#" class="current">Task Statistics</a>
		</div>
	</div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"><i class="icon-th"></i></span>
						<div class="buttons">
							&nbsp;<select name="dateChoose" id="dateChoose" onchange="javascript:gotoUrl(this.value);">
								<option value="jobstatistics?dateChoose=0" <c:if test="${dateChoose == 0}">selected="selected"</c:if>>最近一小时</option>
								<option value="jobstatistics?dateChoose=1" <c:if test="${dateChoose == 1}">selected="selected"</c:if>>最近一天</option>
								<option value="jobstatistics?dateChoose=3" <c:if test="${dateChoose == 3}">selected="selected"</c:if>>最近三天</option>
								<option value="jobstatistics?dateChoose=7" <c:if test="${dateChoose == 7}">selected="selected"</c:if>>最近一周</option>
								<option value="jobstatistics?dateChoose=30" <c:if test="${dateChoose == 30}">selected="selected"</c:if>>最近一月</option>
							</select>
						</div>
						<div class="buttons">
								&nbsp;<a href="javascript:location.reload()" target="_self"
									class="btn btn-mini btn-success"><i class="icon-refresh"></i>Update
									stats</a>
						</div>
					</div>
					<div class="widget-content nopadding">
						<table class="table table-bordered data-table">
							<thead>
								<tr>
									<th>工作类型</th>
									<th>总数量</th>
									<th>未完成数</th>
									<th>等待数</th>
									<th>处理数</th>
									<th>完成数</th>
									<th>成功数</th>
									<th>失败数</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${taskStatisticsListMap}" var="map">
									<tr>
										<td>${map.taskType}</td>
										<td>${map.sumTaskNum}</td>
										<td>${map.notFinishTaskNum}</td>
										<td>${map.waitTaskNum}</td>
										<td>${map.runningTaskNum}</td>
										<td>${map.finishTaskNum}</td>
										<td>${map.successTaskNum}</td>
										<td>${map.failureTaskNum}</td>
										<td><a href="#" id=${map.taskType} class="btn btn-info btn-mini">Info</a></td>
									</tr>
								</c:forEach>
								<tr>
									<td>${sum.memo}</td>
									<td>${sum.sumTaskNum}</td>
									<td>${sum.notFinishTaskNum}</td>
									<td>${sum.waitTaskNum}</td>
									<td>${sum.runningTaskNum}</td>
									<td>${sum.finishTaskNum}</td>
									<td>${sum.successTaskNum}</td>
									<td>${sum.failureTaskNum}</td>
									<td>&nbsp;</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<div class="modal fade in hide" id="config-modal">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal"
			aria-hidden="true">&times;</button>
		<h4>taskStatistics-detail</h4>
	</div>
	<div class="modal-body">

		<table class="table table-bordered table-striped">
			<tr>
				<td>工作类型</td>
				<td id="taskType_modal">${taskType}</td>
			</tr>
			<tr>
				<td>总数量</td>
				<td id="sumTaskNum_modal">${sumTaskNum}</td>
			</tr>
			<tr>
				<td>未完成数</td>
				<td id="notFinishTaskNum_modal">${notFinishTaskNum}</td>
			</tr>
			<tr>
				<td>等待数</td>
				<td id="waitTaskNum_modal">${waitTaskNum}</td>
			</tr>
			<tr>
				<td>等待率</td>
				<td id="waitRate_modal">${waitRate}</td>
			</tr>
			<tr>
				<td>处理数</td>
				<td id="runningTaskNum_modal">${runningTaskNum}</td>
			</tr>
			<tr>
				<td>处理率</td>
				<td id="runningRate_modal">${runningRate}</td>
			</tr>
			<tr>
				<td>完成数</td>
				<td id="finishTaskNum_modal">${finishTaskNum}</td>
			</tr>
			<tr>
				<td>完成率</td>
				<td id="finishRate_modal">${finishRate}</td>
			</tr>
			<tr>
				<td>成功数</td>
				<td id="successTaskNum_modal">${successTaskNum}</td>
			</tr>
			<tr>
				<td>成功率</td>
				<td id="successRate_modal">${successRate}</td>
			</tr>
			<tr>
				<td>失败数</td>
				<td id="failureTaskNum_modal">${failureTaskNum}</td>
			</tr>
			<tr>
				<td>失败率</td>
				<td id="failureRate_modal">${failureRate}</td>
			</tr>
			<tr>
				<td>最小等待(ms)</td>
				<td id="minWaitDuration_modal">${minWaitDuration}</td>
			</tr>
			<tr>
				<td>最大等待(ms)</td>
				<td id="maxWaitDuration_modal">${maxWaitDuration}</td>
			</tr>
			<tr>
				<td>平均等待(ms)</td>
				<td id="avgWaitDuration_modal">${avgWaitDuration}</td>
			</tr>
			
			<tr>
				<td>最小处理(ms)</td>
				<td id="minComputeDuration_modal">${minComputeDuration}</td>
			</tr>
			<tr>
				<td>最大处理(ms)</td>
				<td id="maxComputeDuration_modal">${maxComputeDuration}</td>
			</tr>
			
			<tr>
				<td>平均处理(ms)</td>
				<td id="avgComputeDuration_modal">${avgComputeDuration}</td>
			</tr>
		</table>
	</div>
</div>

<jsp:include page="footer.jsp" />
<script src="${path}/js/monitor-taskstatistics.min.js"></script>
<script type="text/javascript">
  function gotoUrl (newURL) {
	  location.href=newURL;
  }
</script>
</body>
</html>